﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'FN' AND name = 'ufn_UPDMS_Get_Exist_Attach_File')
	BEGIN
		DROP Function ufn_UPDMS_Get_Exist_Attach_File
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : ufn_UPDMS_Get_Exist_Attach_File
**	Desc : 첨부파일이 있는지 여부
**	Test Exec Query : select dbo.ufn_UPDMS_Get_Exist_Attach_File (872, 'Prj1011m')
**	Called by : Anywhere
**	Program ID : Anywhere
**	Auth : 송시명
**	Date : 2013-07-09
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**	
*******************************************************************************/
CREATE FUNCTION [dbo].[ufn_UPDMS_Get_Exist_Attach_File]
(
@ls_activity_id int,
@ls_activity_cd nvarchar(10)
)
RETURNS varchar(1)
AS

BEGIN
    DECLARE @rtn varchar(1)
    SET @rtn = ''

    SELECT @rtn = COUNT(*)
      FROM UPDMS_COM_FILE WITH(NOLOCK)
     WHERE Activity_Id = @ls_activity_id
       AND Activity_Cd = @ls_activity_cd
       
    RETURN LTRIM(RTRIM(@rtn))
END